<template>
	<view class="center">
		<view class="center_top">
			<view class="mask"></view>
		</view>
		<view class="center_box_bg">
			<view class="base">

				<view class="group_item">
					<view class="item_l">头像</view>
					<view class="item_r">
						<u-avatar :src="userInfo.userImg"></u-avatar>
					</view>
				</view>
				<view class="group_item">
					<view class="item_l">用户id</view>
					<view class="item_r">{{userInfo.userId || 'coffee124887964'}}</view>
				</view>
				<view class="group_item">
					<view class="item_l">昵称</view>
					<view class="item_r">{{userInfo.nickName || '小瑞幸'}}</view>
				</view>
				<view class="group_item">
					<view class="item_l">简介</view>
					<view class="item_r">{{userInfo.desc || '这家伙很懒，什么都没留下！'}}</view>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo:{}
			}
		},
		onLoad() {
			this.useGetInfo()
		},
		methods: {
			// 获取个人信息
			useGetInfo() {
				this.$request({
					url: "/findMy",
					success: (res) => {
						if (res.statusCode === 200) {
							uni.hideLoading()
							if (res.data.code === "A001") {
								this.userInfo = res.data.result[0]
							}
							if (res.data.code === 700) {
								uni.showToast({
									title: res.data.msg,
									icon: "none",
									mask: true,
									duration: 1000
								})
								setTimeout(() => {
									uni.navigateTo({
										url: "../login/login"
									})
								}, 1000)

							}

						}
					}
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	page {
		height: 100%;
	}

	.center {
		height: 100%;

		&_top {
			height: 18%;
			background-color: #134cdc;

			.mask {
				background: rgba(0, 0, 0, 0.4);
				height: 100%;
			}
		}

		&_box_bg {
			background: #f9f9f9;
			position: relative;

			.baiban {
				background: #fefefe;
			}

			.base {
				position: absolute;
				width: 90%;
				margin: 0 auto;
				top: -100upx;
				left: 5%;
				background: #fefefe;
				padding: 35upx;
				box-sizing: border-box;
				display: flex;
				flex-direction: column;
				box-shadow: 0px 2px 5px #ededed;
				border-radius: 30upx;
				height: 650rpx;
				overflow-y: auto;

				.group_item {
					margin: 20rpx 0;
					padding: 14rpx 0;
					display: flex;
					justify-content: space-between;
					align-items: center;
					border-bottom: 2rpx solid #d0d0d0;

					.item_r {
						color: gray;
					}
				}
			}
		}

	}
</style>
